<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__static/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="__static/css/public.css" media="all">
    <link rel="stylesheet" href="__static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <style>
        .layui-form-item .layui-input-company {width: auto;padding-right: 10px;line-height: 38px;}
    </style>
</head>
<body>

<div class="layuimini-container">
    <div class="layuimini-main">
        <blockquote class="layui-elem-quote">
            <p><i class="fa fa-cog"></i> 基础配置</p>
        </blockquote>

        <div class="layui-form layuimini-form">
            <div class="layui-form-item">
                <label class="layui-form-label">app_id</label>
                <div class="layui-input-block">
                    <input type="text" name="zj_app_id" placeholder="请输入app_id"  value="{$data.zj_app_id}" class="layui-input">
                    <tip>填写字节跳动app_id。</tip>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">秘钥</label>
                <div class="layui-input-block">
                    <input type="text" name="zj_secret" placeholder="请输入秘钥"  value="{$data.zj_secret|default=''}" class="layui-input">
                </div>
            </div>
			<div class="layui-form-item">
                <label class="layui-form-label">回调地址</label>
                <div class="layui-input-block">
                    <input type="text" name="zj_return_url" placeholder="请输入回调地址"  value="{$data.zj_return_url|default=''}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="setting">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var $ = layui.jquery,
            form = layui.form,
            layer = layui.layer;

        //监听提交
        form.on('submit(setting)', function (data) {
        	var articleFrom = data.field;
			layer.load(1, { shade : [ 0.5, '#676a6c' ] });
            $.post("{:url('zijie_api')}?t=json",articleFrom,function(data){
				layer.closeAll();
				if (data['code'] == 1) { 
					layer.msg(data['msg'], { icon : 6 });
				} else {
					layer.msg(data['msg'], { icon : 5 });
				}
			});
            return false;
        });

    });
</script>
</body>
</html>